package com.szzg10.thinking.chapter11;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class Statistics {

	public static void main(String[] args) {
		Random random = new Random(47);
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		
		for(int i = 0; i < 10000; i++) {
			int key = random.nextInt(20);
			Integer value = map.get(key);
			
			if(value == null) {
				map.put(key, 0);
			}
			else {
				map.put(key, value + 1);
			}
		}
		
		System.out.println(map);
		
	}
}
